import md5 from 'md5';
import uuid from 'uuid';

export const MD5 = md5;

export const UUID = uuid;

export const getExtend = (path) => {
  return path.split('.').pop().substr(0, 4);
};

/**
 * 生成带http开头的链接
 * @param link
 */
export const getHttpLink = (link, https = false) => {
  if (link.startsWith('http') || link.startsWith('https')) {
    return link;
  }
  return https ? `https://${link}` : `http://${link}`;
};

export const cosInfo = () => {
  let info = {
    SecretId: 'AKIDomlnpkwPyLaOEvCAnEj9PZyKVsFSnWYQ',
    SecretKey: '2ykMwRq4BEUegYGpDRWaVJh0AA91jHj1',
    Bucket: 'wewechat-1252599784',
    Region: 'ap-guangzhou',
  }
  return info;
}

